/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cxhd.lis.model.newmodel;

import com.cxhd.lis.util.DateUtil;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;
import java.util.Date;
import java.util.List;

/**
 *
 * @author cxhd
 */
@SuppressWarnings("serial")
public class LisSampletype extends Model<LisSampletype>{
    public static final LisSampletype lisSampletypedao=new LisSampletype();
     public void deleteLisSampletype(int pk){
        Db.use("mysql").update("delete from lis_sampletype where PK=?",pk);
    }
    public void saveLisSampletype(String SAMPLEDESCRIBE,
            String PY,String WB){
//        if(EXTENDTYPE==null||EXTENDTYPE==""){
//            EXTENDTYPE="0";
//        }
 
//               set("SAMPLETYPE",SAMPLETYPE)
               set("SAMPLEDESCRIBE", SAMPLEDESCRIBE)
//                .set("TYPEORDER",TYPEORDER)
                .set("PY", PY)
//                .set("ZDM", ZDM)
                .set("WB", WB)
//                .set("EXTENDTYPE", EXTENDTYPE)          
                .save();
    }
    public void updateLisSampletype(int pk,String SAMPLEDESCRIBE,
           String PY,String WB){
//          if(EXTENDTYPE==null||EXTENDTYPE==""){
//            EXTENDTYPE="0";
//        }
        findById(Integer.valueOf(pk))
//                .set("SAMPLETYPE",SAMPLETYPE)
               .set("SAMPLEDESCRIBE", SAMPLEDESCRIBE)
//                .set("TYPEORDER",TYPEORDER)
                .set("PY", PY)
//                .set("ZDM", ZDM)
                .set("WB", WB)
//                .set("EXTENDTYPE", EXTENDTYPE)     
                .update();
    }
//    public String getPk(){
//         List<Record> list=Db.use("mysql").find("select * from lis_sampletype limit 0,10");
//        String  value = "1";
//        if(list.size()>0){
//        value = (Integer.parseInt(Db.use("mysql").findFirst("SELECT MAX(PK) as id from lis_sampletype ").get("id") + "") + 1) + "";
//        }
//      return value;
//    }
    
    public List<Record> getLisSams(){
        return Db.use("mysql").find("select PK,SAMPLEDESCRIBE from lis_sampletype");
    }
}
